home *** CD-ROM | disk | FTP | other *** search
-
- /********************************************
- **** Animation Class Library V1.0 © 1994 Yves Schmid & Alia Development
- ****
- **** AnimObject.h
- ****
- **** Created: 01 June 1994
- **** Modified: 01 September 1994
- **** Version: 0
- **** Compatible: C++, Mac System 7
- ****
- **** Description: • Anim class is an abstract class which defines the base
- **** of an animation object. If you want to create a new kind of
- **** animation you should override this class.
- ****
- **** • Anim is a child class of the AnimSupervisor class.
- ****
- *******************/
-
- #ifndef AnimObject_H
- #define AnimObject_H
-
-
- #include "AnimSupervisor.h"
-
- class AnimBase;
- class Anim;
-
- class AnimObject: public AnimSupervisor
- {
-
- //***********************************************************
- //.............. P U B L I C M E T H O D S.................
-
- public:
-
- AnimObject(AnimSupervisor *base);
- ~AnimObject(void);
-
- // Changing the supervisor
- void setanimsupervisor(AnimSupervisor *base);
-
- // Gets superanim, returns NULL if there is no superanim (if supervisor is an AnimBase)
- AnimObject *getsuperanim(void);
-
- inline void setdeletenextupdate(const Boolean d) {delnextupdate = d;}
- inline Boolean getdeletenextupdate(void) const {return delnextupdate;}
- // If TRUE this animation object will be
- // deleted at the next update
-
-
- inline float getx(void) const {return x;} // Finds position
- inline float gety(void) const {return y;}
-
- inline float &getoldx(void) {return oldx;} // Gets/Sets old position
- inline float &getoldy(void) {return oldy;}
-
- inline void place(float ax, float ay) // Places object to a new position
- { // (sets oldx and oldy to x and y)
- oldx = x = ax;
- oldy = y = ay;
- }
-
- inline void move(float deltax, float deltay) // Moves object with deltas
- { // (sets oldx and oldy to the previous position)
- oldx = x; oldy = y;
- x+=deltax; y+=deltay;
- }
-
- virtual void findmaxsize(short *width, short *height) const;
- // Finds the maximum pixels size of the
- // object.
- // You can pass NULL pointers.
-
- virtual void findcurrect(Rect *rect); // Finds the visual rect of the
- // object in his current state.
-
-
- virtual void findcursize(short *width, short *height);
- // Finds the maximum pixels size of the
- // object in his current state.
- // You can pass NULL pointers.
-
- virtual void findabsxy(short *gx, short *gy);
- virtual void findabsxy(float *gx, float *gy);
- // Finds the absolute position of the object. Very
- // useful when you have objects which have relative
- // positions (subanims for example).
- // You can pass NULL pointers.
-
-
- // Gets/sets sorting priority. (Default is 0).
- inline short getpriority(void) const {return priority;}
- inline void setpriority(const short p) {priority = p;}
-
-
- // Gets/sets collision keys
- inline unsigned long getcollisionkey_me(void) const {return collisionkey_me;}
- inline unsigned long getcollisionkey_hit(void) const {return collisionkey_hit;}
-
- inline void setcollisionkey_me(const unsigned long m) {collisionkey_me = m;}
- inline void setcollisionkey_hit(const unsigned long h) {collisionkey_hit = h;}
-
-
- virtual Boolean checkcollision(AnimObject *);
- // If there is a collision between this animation
- // and the passed animation returns TRUE.
- // The collisionkeys of the two animations are ANDed ("hit" key
- // is ANDed with the "me" key).
- // If the result of the AND is zero, checkcollision returns
- // FALSE without checking collision at a more
- // elaborated level.
-
-
-
-
- //***********************************************************
-
- //..........................................................
- // You should not call the following methods!
-
- virtual Boolean draw(short basex =0, short basey =0);
- virtual Boolean mustbemasked(void) const;
-
- virtual void getcollisionmask(BitMap **b, unsigned long **lmask, Rect *);
-
- virtual void process_submasking(AnimBase *base, Rect *maskrect);
-
-
- //..........................................................
-
-
- protected:
-
-
- short priority;
-
-
- virtual void processcontrols(void);
-
-
- virtual AnimObject *drawsubanims(Boolean neg, AnimObject *start, short basex, short basey);
-
-
- private:
-
- unsigned long collisionkey_me;
- unsigned long collisionkey_hit;
-
- Boolean delnextupdate;
-
-
- float x,y;
- float oldx,oldy;
-
-
- virtual void privfindabsxy(float *gx, float *gy);
- virtual void privfindabsxy(short *gx, short *gy);
- };
-
-
-
- #endif
-
-